home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / dev / mui / mui37_de.lha / Amiga-E / Examples / Balancing.e < prev    next >
Text File  |  1996-08-25  |  7KB  |  135 lines

  1. /*
  2. ** MUI-Demosource in E.
  3. ** Based on the C example 'Balancing.c' by Stefan Stuntz.
  4. ** Translated TO E by Sven Steiniger
  5. **
  6. ** Sorry FOR some uppercase words in the comments. This IS because OF
  7. ** my AutoCase-dictionary
  8. */
  9.  
  10. OPT PREPROCESS
  11.  
  12. MODULE 'muimaster','libraries/mui',
  13.        'intuition/classes','intuition/classusr',
  14.        'dos/dos',
  15.        'utility/tagitem','utility/hooks',
  16.        'amigalib/boopsi'
  17.  
  18. PROC main() HANDLE
  19. DEF app=NIL,window,sigs=0
  20.  
  21.   IF (muimasterbase:=OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN
  22.      Raise('Couldn''t open muimaster.library')
  23.  
  24.         app:=ApplicationObject,
  25.                 MUIA_Application_Title      , 'BalanceDemo',
  26.                 MUIA_Application_Version    , '$VER: BalanceDemo 12.10 (21.11.95)',
  27.                 MUIA_Application_Copyright  , '©1995, Stefan Stuntz',
  28.                 MUIA_Application_Author     , 'Stefan Stuntz',
  29.                 MUIA_Application_Description, 'Show balancing groups',
  30.                 MUIA_Application_Base       , 'BALANCEDEMO',
  31.  
  32.                 SubWindow, window:=WindowObject,
  33.                         MUIA_Window_Title, 'Balancing Groups',
  34.                         MUIA_Window_ID   , "BALA",
  35.                         MUIA_Window_Width , MUIV_Window_Width_Screen(50),
  36.                         MUIA_Window_Height, MUIV_Window_Height_Screen(50),
  37.  
  38.                         WindowContents, HGroup,
  39.  
  40.                                 Child, VGroup, GroupFrame, MUIA_Weight, 15,
  41.                                         Child, RectangleObject, TextFrame, MUIA_Weight,  50, End,
  42.                                         Child, RectangleObject, TextFrame, MUIA_Weight, 100, End,
  43.                                         Child, BalanceObject, End,
  44.                                         Child, RectangleObject, TextFrame, MUIA_Weight, 200, End,
  45.                                         End,
  46.  
  47.                                 Child, BalanceObject, End,
  48.  
  49.                                 Child, VGroup,
  50.                                         Child, HGroup, GroupFrame,
  51.                                                 Child, RectangleObject, TextFrame, MUIA_ObjectID, 123, End,
  52.                                                 Child, BalanceObject, End,
  53.                                                 Child, RectangleObject, TextFrame, MUIA_ObjectID, 456, End,
  54.                                                 End,
  55.                                         Child, HGroup, GroupFrame,
  56.                                                 Child, RectangleObject, TextFrame, End,
  57.                                                 Child, BalanceObject, End,
  58.                                                 Child, RectangleObject, TextFrame, End,
  59.                                                 Child, BalanceObject, End,
  60.                                                 Child, RectangleObject, TextFrame, End,
  61.                                                 Child, BalanceObject, End,
  62.                                                 Child, RectangleObject, TextFrame, End,
  63.                                                 Child, BalanceObject, End,
  64.                                                 Child, RectangleObject, TextFrame, End,
  65.                                                 End,
  66.                                         Child, HGroup, GroupFrame,
  67.                                                 Child, HGroup,
  68.                                                         Child, RectangleObject, TextFrame, End,
  69.                                                         Child, BalanceObject, End,
  70.                                                         Child, RectangleObject, TextFrame, End,
  71.                                                         End,
  72.                                                 Child, BalanceObject, End,
  73.                                                 Child, HGroup,
  74.                                                         Child, RectangleObject, TextFrame, End,
  75.                                                         Child, BalanceObject, End,
  76.                                                         Child, RectangleObject, TextFrame, End,
  77.                                                         End,
  78.                                                 End,
  79.                                         Child, HGroup, GroupFrame,
  80.                                                 Child, RectangleObject, TextFrame, MUIA_Weight,  50, End,
  81.                                                 Child, RectangleObject, TextFrame, MUIA_Weight, 100, End,
  82.                                                 Child, BalanceObject, End,
  83.                                                 Child, RectangleObject, TextFrame, MUIA_Weight, 200, End,
  84.                                                 End,
  85.                                         Child, HGroup, GroupFrame,
  86.                                                 Child, SimpleButton('Also'),
  87.                                                 Child, BalanceObject, End,
  88.                                                 Child, SimpleButton('Try'),
  89.                                                 Child, BalanceObject, End,
  90.                                                 Child, SimpleButton('Sizing'),
  91.                                                 Child, BalanceObject, End,
  92.                                                 Child, SimpleButton('With'),
  93.                                                 Child, BalanceObject, End,
  94.                                                 Child, SimpleButton('Shift'),
  95.                                                 End,
  96.                                         End,
  97.                                 End,
  98.                         End,
  99.  
  100.                 End;
  101.  
  102.         IF app=NIL THEN Raise('Failed TO create Application.')
  103.  
  104.         doMethodA(window,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,
  105.                   app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit]);
  106.  
  107.  
  108. /*
  109. ** This is the ideal input loop for an object oriented MUI application.
  110. ** Everything is encapsulated in classes, no return ids need to be used,
  111. ** we just check if the program shall terminate.
  112. ** Note that MUIM_Application_NewInput expects sigs to contain the result
  113. ** from Wait() (or 0). This makes the input loop significantly faster.
  114. */
  115.  
  116.         set(window,MUIA_Window_Open,MUI_TRUE);
  117.  
  118.         WHILE Not(doMethodA(app,[MUIM_Application_NewInput,{sigs}])=MUIV_Application_ReturnID_Quit)
  119.           IF sigs THEN sigs:=Wait(sigs)
  120.         ENDWHILE
  121.  
  122.         set(window,MUIA_Window_Open,FALSE);
  123.  
  124.  
  125. /*
  126. ** Shut down...
  127. */
  128.  
  129. EXCEPT DO
  130.    IF app THEN Mui_DisposeObject(app)
  131.    IF muimasterbase THEN CloseLibrary(muimasterbase)
  132.    IF exception THEN WriteF('\s\n',exception)
  133. ENDPROC
  134.  
  135.